﻿#if UNITY_EDITOR
using System.IO;
using CSUtils;
using UnityEditor;
using Editor_ExcelTools;
using M3ExcelToConfig;
using U3dUtils;
using U3dUtilsEditor;
using UnityEngine;
public class Editor_ExcelTool{
    static string sourceFileDir = $"{Application.dataPath}/../ExcelConfig";
    static string codeTargetDir = $"{Application.dataPath}/Remote/Scripts/ExcelConfig";

    [MenuItem("Game02/ExcelConfig/生成全部")]
    public static void GenExcelConfig(){
        CLogCat.GetInstance().Init(true, true);
        sourceFileDir = new DirectoryInfo(sourceFileDir).FullName;
        var sourceFilePathArr = Directory.GetFiles(sourceFileDir, "*.xlsx", SearchOption.AllDirectories);
        WeCfg_ExcelToClass.ExcelFileExpotCSWeProto(sourceFileDir, sourceFilePathArr, codeTargetDir, EWeFileType.excel, ExcelWe_GenType.e02_GenCode);

        Debug.LogError($"excel目录....{sourceFileDir}");
        Debug.LogError($"目标目录....{codeTargetDir}");
        AssetDatabase.Refresh();
    }

    [MenuItem("Game02/生成WeProto-类型注册")]
    public static void GenExcel222(){
        Editor_GenAutoWeProto.GenCode(ECodeType.e12_cs);
        AssetDatabase.Refresh();
    }
}

#endif
